package com.kaguya.facade;

/**
 * 外观模式 结构性,隐藏内部细节，让调用方可以方便的使用。符合最小知识原则
 */
public class Facade {
    public static void main(String[] args) {
        Box box = new Box();
        box.openBox();
    }
}

/**
 * 包装盒，提供拆盒子的方法
 */
class Box {
    public Something something = new Something();

    public void openBox() {
        something.putCake();
        something.putCola();
        something.putHamburger();
    }
}

/**
 * 将一些东西放入盒子中
 */
class Something {
    public void putCake() {
        System.out.println("this is a cake");
    }

    public void putCola() {
        System.out.println("here is a can of cola");
    }

    public void putHamburger() {
        System.out.println("this is a hamburger");
    }
}
